package com.food.mapper;

import com.food.model.User;
import com.food.model.UserProfile;
import com.food.dto.UserRegisterDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    User findByUsername(String username);
    void insert(UserRegisterDTO registerDTO);
    User findById(Integer userId);
    User findByEmail(String email);
    UserProfile findProfileByUserId(Integer userId);
    void updateProfile(UserProfile profile);
    void updatePassword(@Param("userId") Integer userId, @Param("newPassword") String newPassword);
    void insertProfile(UserProfile profile);
    int countProfile(Integer userId);
    @Update("UPDATE Users SET avatar = #{avatar} WHERE user_id = #{userId}")
    void updateAvatar(@Param("userId") Integer userId, @Param("avatar") String avatar);
    void insertWithAvatar(@Param("dto") UserRegisterDTO registerDTO, @Param("avatar") String avatar);
    String getAvatarUrl(Integer userId);
} 